import { takeLatest,takeEvery,put,take} from 'redux-saga/effects'
import { GET_SAGALIST,DELETE_SAGALISTITEM } from '../constants'
import { setSagaListAction,deleteSagaListItem } from '../actions/user'

function* getList(){
    const res =  [ { title:"吃饭" },{ title:"睡觉" }];
    const action = setSagaListAction(res);
    yield put(action);
}

function* deleteToDoItem(index){
    const action = deleteSagaListItem(index);
    yield put(action);
}

export default function* rootSaga(){
    yield takeEvery(GET_SAGALIST,getList);
    yield take(DELETE_SAGALISTITEM,deleteToDoItem);
}


